<?php
 require('ColourLovers.php');
    $c = new ColourLovers();
   // $c->set_result_type('array');
    $colors = array(
        'keywords'=>'flight',
        'numResults'=>1,
        'resultOffset'=>5,
        );
    $result = $c->palettes($colors);
    var_dump($result['@attributes']);
   // $a = new SimpleXMLElement();
    //$a->attributes()
    ?>

<p> Co <b><?php echo $result['@attributes']['totalResults']; ?></b> ket qua cho tu khoa <b><?php echo $colors['keywords']; ?></b> !</p>
<?php
    foreach ($result['palette'] as $palete) :
    ?>
<h3 style="clear: both; margin: 15px 0 5px 0 ; float: left;"><?php   echo $palete['title']; ?></h3>
<div style="float: left; clear: both;">
<?php
    foreach ($palete['colors']['hex'] as $color) :
?>
    <a href="<?php echo '#'.$color;?>" >
        <span style=" margin: 2px; background: <?php echo '#'.$color;?>; border:1px dashed <?php echo '#'.$color;?>; width: 24px; height: 24px; float: left;"></span>
    </a>
<?php endforeach;
?>
    </div>
    <?php
    endforeach;
?>

